#!/usr/bin/evn python
"""
Parameters associated with RNA design 
"""

class Param(object):
    """
    Parameter for RNA design
    """
    def __init__(self):
        """Empty constructor
        """
        self.seq = ''          #
        self.struct = ''       #
        self.mda_motif = ''    #
        self.fbdn = ''         #
        self.fsa_seq = False   # to generate sequences of FSA?
        self.outprefix = ''    # out prefix
        self.plot = False      # plot FSA
        self.gen = None        # number of sequences to generate, default all
        
    def set_one(self, k, v):
        """Set one attribute-value
        """
        #assert k in self.__dict__
        self.__setattr__(k, v)
        
    def set(self, p):
        """Set attributes from a dict
        """
        assert isinstance(p, dict)
        for k, v in p.items():
            self.set_one(k, v)

    def check(self):
        """Check whether essential attributes
        """
        assert self.struct
        assert self.seq
        assert self.outprefix
        assert len(self.struct) == len(self.seq)
        self.len = len(self.struct)

    def __str__(self):
        return (('sequence\t: %s\n' 
            + 'structure\t: %s\n' 
            + 'mda_motif\t: %s\n' 
            + 'file_fbdn\t: %s\n' 
            + 'outprefix\t: %s') % (self.seq, self.struct, self.mda_motif,
            self.fbdn, self.outprefix))
        
###############################################################################